<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>系统安装</title>
  <link rel="stylesheet" href="../src/layui/css/layui.css">
  <link rel="stylesheet" href="../src/css/style.css">

<script src="../src/js/jquery-1.8.3.min.js"></script>
<script>

  function TestDb()
    {
    var dbhost = $('#dbhost').val();
        var dbuser = $('#dbuser').val();
        var dbpwd = $('#dbpwd').val();
    $('#havedbsta').html('<img src=\'../src/img/ajax-loader.gif\'>');
        var ajaxurl = 'index.php?step=10&dbhost='+dbhost+'&dbuser='+dbuser+'&dbpwd='+dbpwd;
    $.get(ajaxurl,function(response){
          $('#havedbsta').html(response);
      },"html");
    HaveDB();
    };
  
  function HaveDB()
    {
    var dbhost = $('#dbhost').val();
        var dbname = $('#dbname').val();
        var dbuser = $('#dbuser').val();
        var dbpwd = $('#dbpwd').val();
        var ajaxurl = 'index.php?step=10&dbhost='+dbhost+'&dbuser='+dbuser+'&dbpwd='+dbpwd+'&dbname='+dbname;
    $.get(ajaxurl,function(response){
          $('#havedbsta').html(response);
      },"html");
    };
    
    function DoInstall()
    {
        document.form1.submit();
    };

</script> 
<style type="text/css">
  .layui-form-label{ width:25% }
  .layui-inline{ width: 100% ; line-height: 40px;}
</style>
</head>
<body>
  <nav>
    <ul class="layui-nav layui-bg-green ">
     <div class="layui-container">  
      <li class="layui-nav-item layui-this"><h1 class="font-h1">系统安装向导</h1></li>
      <li class="layui-nav-item">

      </li>
      <li class="layui-nav-item fr">
      	<a name="grid" href="http://guestbook.eedo.net/guestbook.html" target="_blank">eedo留言管理系统</a>
      </li>
      <span class="layui-nav-bar" style="left: 307.5px; top: 55px; width: 0px; opacity: 0;"></span>
    </div>
  </ul>
</nav>
<div class="layui-container">  

  <div class="layui-row">
  	<div class="layui-row mt2 mb2">
     <span class="layui-breadcrumb" lay-separator=">">
       <a>许可协议</a>
       <a class="font-h1">环境检测</a>
       <a>参数配置</a>
       <a>安装完成</a>
     </span>
   </div>
 </div>

  <form action="index.php" method="post" name="form1">
  <input type="hidden" name="step" value="4" />
    <blockquote class="layui-elem-quote news_search">
     数据库设定
      <div class="layui-inline" id="notice">
        <div class="layui-form-mid layui-word-aux">
        </div>
      </div>
    </blockquote>

      <div class="layui-form-item">
        <div class="layui-inline">    
          <label class="layui-form-label">数据库主机：</label>
          <div class="layui-input-inline">
            <input name="dbhost" id="dbhost" type="text" value="localhost"  class="layui-input newsAuthor" lay-verify="required" >
          </div>
          <div class="layui-form-mid layui-word-aux">
          请输入域名（IP）：端口号，例如localhost:3360，默认端口号无需输入
          </div>
        </div>

        <div class="layui-inline">    
          <label class="layui-form-label">数据库用户：</label>
          <div class="layui-input-inline">
            <input name="dbuser" id="dbuser" type="text" value="root"  class="layui-input newsAuthor" lay-verify="required" >
          </div>
        </div>
        <div class="layui-inline">    
          <label class="layui-form-label">数据库密码：</label>
          <div class="layui-input-inline">
            <input  name="dbpwd" id="dbpwd" type="text" class="layui-input newsAuthor" lay-verify="required" >
          </div>
          <div class="layui-form-mid layui-word-aux"  id='dbpwdsta'>
         
          </div>
        </div>
        <div class="layui-inline">    
          <label class="layui-form-label">数据库名称：</label>
          <div class="layui-input-inline">
            <input name="dbname" id="dbname" type="text" value="<?php echo $dfDbname; ?>" class="layui-input newsAuthor" lay-verify="required" onChange="HaveDB()"  >
          </div>
          <div class="layui-form-mid layui-word-aux" id='havedbsta'>
          </div>
        </div>
        <div class="layui-inline">    
          <label class="layui-form-label">数据库编码：</label>

          <input type="radio" name="dblang" id="dblang_utf8" value="utf8" checked="checked" /><label for="dblang_latin1">UTF8</label><small>目前只支持utf-8</small>
        </div>
        <blockquote class="layui-elem-quote news_search">
         管理员设定
          <div class="layui-inline" id="notice">
            <div class="layui-form-mid layui-word-aux">
            </div>
          </div>
        </blockquote>
        <div class="layui-inline">    
          <label class="layui-form-label">用户名：</label>
          <div class="layui-input-inline">
            <input name="adminuser" type="text" value="admin" class="layui-input newsAuthor" lay-verify="required" onChange="HaveDB()"  disabled>
          </div>
          <div class="layui-form-mid layui-word-aux">
            [安装后网站后台修改]
          </div>
        </div>
        <div class="layui-inline">    
          <label class="layui-form-label">密　码：</label>
          <div class="layui-input-inline">
            <input name="adminpwd" type="text" value="123456" class="layui-input newsAuthor" lay-verify="required" onChange="HaveDB()"  disabled>
          </div>
          <div class="layui-form-mid layui-word-aux">
           [安装后网站后台修改]
          </div>
        </div>
      </div>
    <div class="layui-form-item  tc">
     <button class="layui-btn layui-btn-primary" lay-submit="" onclick="window.location.href='index.php?step=2';">后退</button>
     <button type="reset" class="layui-btn" onclick="DoInstall();">开始安装</button>
      </div> 
  </form>
</div>
</body>
</html>